131 implement redesigned dormitory details page and extend cms collection#171
Conversation
…n and extend dormitory collection
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR introduces a new "dormitories" Payload CMS collection with schema, migrations, and generated types, adds ChangesDormitory CMS Feature
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Page as DormitoryListPage
participant Dict as getDictionary
participant CMS as getDormitories
participant Card as ImageCard
Page->>Dict: fetch dormitories dictionary
Page->>CMS: fetch dormitory records
CMS-->>Page: dormitories with coverImage
Page->>Page: build cards, filter invalid coverImage
Page->>Card: render ImageCard per valid dormitory
sequenceDiagram
participant Page as DormitoryDetailsPage
participant CMS as getDormitoryBySlug
participant NotFound as notFound
participant UI as RichText/Gallery/Sidebar
Page->>CMS: fetch dormitory by slug
CMS-->>Page: dormitory record or undefined
alt not found
Page->>NotFound: trigger 404
else found
Page->>UI: render description, gallery, sidebar
end
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/migrations/20260703_140815_dormitories_collection.ts`:
- Line 9: The dormitories migration defines cover_image_id as NOT NULL while its
foreign key uses ON DELETE set null, which is incompatible. Update the foreign
key behavior in the migration that creates the cover_image_id relation to use ON
DELETE restrict, or alternatively make cover_image_id nullable if null-on-delete
is intended; use the cover_image_id column definition in
20260703_140815_dormitories_collection as the place to fix it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8ce98fef-e1d9-4d43-8988-09e52971a970
📒 Files selected for processing (12)
src/app/(app)/[lang]/kollegium/kollegium-bemutato/[slug]/page.tsxsrc/app/(app)/[lang]/kollegium/kollegium-bemutato/page.tsxsrc/collections/Dormitories.tssrc/components/common/ImageCard.tsxsrc/dictionaries/en/dormitories.jsonsrc/dictionaries/hu/dormitories.jsonsrc/lib/payload-cms.tssrc/migrations/20260703_140815_dormitories_collection.tssrc/migrations/20260703_143300_extend_dormitories_details.tssrc/migrations/index.tssrc/payload-types.tssrc/payload.config.ts
| "id" serial PRIMARY KEY NOT NULL, | ||
| "name" varchar NOT NULL, | ||
| "slug" varchar NOT NULL, | ||
| "cover_image_id" integer NOT NULL, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the migration file
wc -l src/migrations/20260703_140815_dormitories_collection.ts
cat -n src/migrations/20260703_140815_dormitories_collection.ts | sed -n '1,220p'
# Find the collection schema and related references
rg -n "coverImage|cover_image_id|dormitories" src -g '!**/node_modules/**'Repository: kir-dev/ehk
Length of output: 18275
🏁 Script executed:
#!/bin/bash
set -euo pipefail
wc -l src/collections/Dormitories.ts
cat -n src/collections/Dormitories.ts | sed -n '1,180p'Repository: kir-dev/ehk
Length of output: 1945
cover_image_id can’t be SET NULL while remaining NOT NULL
ON DELETE set null on "cover_image_id" will fail whenever a referenced media row is deleted. Use ON DELETE restrict here, or make the column nullable if null-on-delete is intended.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/migrations/20260703_140815_dormitories_collection.ts` at line 9, The
dormitories migration defines cover_image_id as NOT NULL while its foreign key
uses ON DELETE set null, which is incompatible. Update the foreign key behavior
in the migration that creates the cover_image_id relation to use ON DELETE
restrict, or alternatively make cover_image_id nullable if null-on-delete is
intended; use the cover_image_id column definition in
20260703_140815_dormitories_collection as the place to fix it.
Summary by CodeRabbit